package com.jxpanda.infrastructure.crypto.key;

import com.jxpanda.infrastructure.crypto.key.contract.AbstractKeyProvider;
import com.jxpanda.infrastructure.crypto.key.contract.SecretKeyProvider;
import com.jxpanda.infrastructure.crypto.model.SecretKeyGenParameterSpec;

import javax.crypto.SecretKey;

public class HmacKeyProvider extends AbstractKeyProvider<SecretKey, SecretKeyGenParameterSpec> implements SecretKeyProvider {

    private final int keySize;

    public HmacKeyProvider(String algorithm, int keySize) {
        super(algorithm);
        this.keySize = keySize;
    }

    @Override
    public SecretKey generateKey() {
        return generateKey(new SecretKeyGenParameterSpec(this.keySize));
    }
}
